package zdream.control.foe.mmcommon;

import zdream.control.world.MFoe;
import zdream.control.world.Ticker;
import zdream.control.world.buff.HealthModule;

/**
 * 只有 {@link MFoe#TYPE_LEADER} 类型的 {@link MFoe} 才会产生该类
 *
 * @author Zdream
 * @date 2024-01-02
 * @since 0.0.1
 */
public class AshesLeader extends Ashes {
	public static final String NAME = "MMCommonAshesLeader";

	/**
	 * ashes 的移动速度
	 */
	public final float vx, vy;

	public AshesLeader(MFoe foe, float vx, float vy) {
		super(foe);
		this.vx = vx;
		this.vy = vy;
	}

	@Override
	public String foeName() {
		return NAME;
	}

	@Override
	protected HealthModule createHealthModule() {
		return buildHealthModule()
					.outsideDestroyThreshold(1000)
					.create();
	}

	@Override
	public void tick(Ticker ticker) {
		super.tick(ticker);

		if (ticker.foePaused) {
			return;
		}

		if (vx == 0 && vy == 0) {
			return;
		}
		this.addAnchor(vx * ticker.duration, vy * ticker.duration);
		this.flush();
	}
}
